import axios from "@/api/axios"

const register = (credentials) => {
  return axios.post("/users", {user: credentials})
}

const login = (credentials) => {
  return axios.post("/users/login", {user: credentials})
}

const getCurrentUser = () => {
  return axios.get("/users/current")
}

const updateCurrentUser = (currentUserInput) => {
  console.log('api currentUserInput',currentUserInput)
  return axios
    .put("/users/current", {user: currentUserInput})
    .then((response) => response.data.user)
}

export default {
  register,
  login,
  getCurrentUser,
  updateCurrentUser,
}
